package com.xiaoxi.open.design.behavioral.chainofresponsibilitypattern.service.verify;

import com.xiaoxi.open.design.behavioral.chainofresponsibilitypattern.domain.verify.UserInfo;
import org.springframework.stereotype.Component;

/**
 * @Author xiaoxi
 * @ProjectName chain_of_responsibility_pattern
 * @PackageName com.xiaoxi.open.design.behavioral.chainofresponsibilitypattern.service.verify
 * @ClassName PasswordCheck
 * @Description TODO
 * @Date 2024/4/24 19:03
 * @Version 1.0
 */
@Component
public class PasswordCheck extends AbstractLoginCheck {

    private String password;

    public PasswordCheck() {
    }

    public PasswordCheck(String password) {
        this.password = password;
    }

    @Override
    public void doHandler(UserInfo userInfo) throws Exception {
        if (!password.equals(userInfo.getPassword())) {
            throw new Exception("密码错误");
        }
    }
}
